package com.easyj.base.security;

import org.springframework.security.core.GrantedAuthority;
import org.springframework.util.Assert;

public class EasyjGrantedAuthority implements GrantedAuthority{

		private static final long serialVersionUID = 5101251955508558686L;

		private  String authority;

		public EasyjGrantedAuthority() {
			
		}
		public EasyjGrantedAuthority(String authority) {
			Assert.hasText(authority, "A granted authority textual representation is required");
			this.authority = authority;
		}
		
		@Override
		public String getAuthority() {
			return authority;
		}
		
		

		public void setAuthority(String authority) {
			this.authority = authority;
		}

		@Override
		public int hashCode() {
			final int prime = 31;
			int result = 1;
			result = prime * result + ((authority == null) ? 0 : authority.hashCode());
			return result;
		}

		@Override
		public boolean equals(Object obj) {
			if (this == obj)
				return true;
			if (obj == null)
				return false;
			if (getClass() != obj.getClass())
				return false;
			EasyjGrantedAuthority other = (EasyjGrantedAuthority) obj;
			if (authority == null) {
				if (other.authority != null)
					return false;
			} else if (!authority.equals(other.authority))
				return false;
			return true;
		}
	

}
